package com.chzc.fm.duotin.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

import com.chzc.fm.duotin.R;
import com.chzc.fm.duotin.bean.home.RecommendDataList;

import java.util.List;

/**
 * Created by Administrator on 2016/6/24.
 */
public class HomeLayout extends RelativeLayout {

    private HomeItem item1,item2,item3;

    public HomeLayout(Context context, List<RecommendDataList> dataList) {
        super(context);
        initViews(context);
        setDataList(dataList);
    }

    public HomeLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initViews(context);
    }
    private void initViews(Context context){
        inflate(context, R.layout.fragment_home_layout,this);
        item1 = (HomeItem) findViewById(R.id.list_item1);
        item2 = (HomeItem) findViewById(R.id.list_item2);
        item3 = (HomeItem) findViewById(R.id.list_item3);
    }
    private void setDataList(List<RecommendDataList> dataList){
       /*显示内容*/
        item1.setRecommendData(dataList.get(0));
        item2.setRecommendData(dataList.get(1));
        item3.setRecommendData(dataList.get(2));
    }
}
